//
//  ShopEditTableViewCell.m
//  YiBaoStore
//
//  Created by 吕清毅 on 2018/10/4.
//  Copyright © 2018年 小河. All rights reserved.
//

#import "ShopEditTableViewCell.h"

@implementation ShopEditTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setView];
        self.backgroundColor = TotalWhite;
    }
    return self;
}
//57
- (void)setView
{
    if (!self.leftLab) {
        self.leftLab = [UILabel new];
        self.leftLab.textColor = titleColor;
        self.leftLab.font = FontMediumWithSize(16);
        [self addSubview:self.leftLab];
    }
    if (!self.arrowIV) {
        self.arrowIV = [UIImageView new];
        self.arrowIV.image = [UIImage imageNamed:@"shopMore"];
        [self addSubview:self.arrowIV];
    }
    if (!self.iconIV) {
        self.iconIV = [UIImageView new];
        [self addSubview:self.iconIV];
    }
    if (!self.rightLab) {
        self.rightLab = [UILabel new];
        self.rightLab.textAlignment = NSTextAlignmentRight;
        self.rightLab.textColor = UIColorFromHex(0x999999);
        self.rightLab.font = FontSemiboldSize(14);
        [self addSubview:self.rightLab];
    }
    if (!self.lineView) {
        self.lineView = [UIView new];
        self.lineView.backgroundColor = UIColorFromHex(0xF1F1F1);
        [self addSubview:self.lineView];
    }
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.leftLab.frame = CGRectMake(15, 20, 80, 16);
    self.arrowIV.frame = CGRectMake(self.width-33, 19, 18, 18);
    self.iconIV.frame = CGRectMake(self.width-33-21, 20, 16, 16);
    if (self.indexPath.row == 0) {
        self.iconIV.frame = CGRectMake(self.width-33-35, 12, 30, 30);
        self.iconIV.layer.cornerRadius = 15;
//        self.iconIV.image = [UIImage imageNamed:@"Placeholder100"];
        self.iconIV.layer.masksToBounds = YES;
    }
    
    if (self.indexPath.row == 2 || self.indexPath.row == 3 || self.indexPath.row == 4) {
        self.rightLab.frame = CGRectMake(100, 21, self.width-100-33-5, 14);
    }else if (self.indexPath.row == 1)
    {
        self.rightLab.frame = CGRectMake(100, 21, self.width-100-15, 14);
    }
//    else
//    {
//        self.rightLab.frame = CGRectMake(100, 21, self.width-100-50-33-5, 14);
//    }
    
    self.lineView.frame = CGRectMake(15, self.height-1, self.width-30, 1);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
